#!/bin/sh

#kill server
SERVICE_HOME=/data/eureka-config-server
LIB_DIR=${SERVICE_HOME}/lib

JAR_NAME=""
files=`ls -1 ${LIB_DIR}`
for file in ${files} ;do
        JAR_NAME=${LIB_DIR}/${file}
done

SERVER_PID=`ps auxf | grep ${JAR_NAME} | grep -v "grep"| awk '{print $2}'`
echo "${JAR_NAME} pid is ${SERVER_PID}"
if [ -n $SERVER_PID ] 
then
  kill $SERVER_PID
  echo "$SERVER_PID is killed!"
fi
